<?php
namespace App\Http\Controllers\Front;

use App\Models\Link;
use App\Models\News;
use App\Models\SystemSetting;


class ContentController extends MasterController
{
    protected $nav;         //当前焦点
    protected $infos;
    public function __construct(){
        parent::__construct();
        $systemSetting = new SystemSetting();
        $this->infos = $systemSetting->getSetting("index");
        $this->nav=5;
    }
    /**
     * 关于我们
     */
    public function about()
    {
        $info = $this->infos['about'];
        return view('front.content.about')
                  ->with('nav',$this->nav)
                  ->with('name','关于我们')
                  ->with('info',$info);
    }

    /**
     * 合作加盟
     */
    public function join()
    {
        $info = $this->infos['join'];
        return view('front.content.join')
            ->with('nav',$this->nav)
            ->with('name','合作加盟')
            ->with('info',$info);
    }

    /**
     * 联系我们
     */
    public function contact()
    {
        $info = $this->infos['contact'];
        return view('front.content.contact')
            ->with('nav',$this->nav)
            ->with('name','联系我们')
            ->with('info',$info);
    }

    /**
     * 友情链接
     */
    public function links()
    {
        $info = Link::where('is_disabled','=',0)->get();
        return view('front.content.links')
            ->with('nav',$this->nav)
            ->with('name','友情链接')
            ->with('infos',$info);
    }

    /**
     * 新闻
     */
    public function news()
    {
        $info = News::all();
        return view('front.content.news')
            ->with('nav',$this->nav)
            ->with('name','新闻')
            ->with('infos',$info);
    }

    /**
     * 新闻详情
     */
    public function newsdetail($id)
    {
        $info = News::find($id);
        return view('front.content.detail')
            ->with('nav',$this->nav)
            ->with('info',$info);
    }

}
